package com.qf.limit.commons.utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 存储验证码
 */
public class CodesUtils {
    /**
     * map集合 - 存在机器的内存
     * key - 用户名
     * value - 验证码
     */
    private static Map<String,Integer> codes = new ConcurrentHashMap<>();

    public static void putCode(String username, Integer code){
        codes.put(username,code);
    }

    public static Integer getCode(String username){
        return codes.get(username);
    }

    public static void remove(String username){
        codes.remove(username);
    }
}
